//*******************************************************************
//  PropertyCardPanel.java       Author: Jason M. Campbell
//
//  Panel on which to display a PropertyCard.  Will be displayed by
//  choosing a menu option in the PropertyMenuPanel.
//*******************************************************************

import javax.swing.*;
import java.awt.*;

public class PropertyCardPanel extends JPanel
{
	//private final int WIDTH = 279, HEIGHT = 325; // panel size
	private final int WIDTH = 290, HEIGHT = 367; // panel size
	private ImageIcon image; // image used for the PropertyCard jpg files
	
	private JLabel cost; // cost to buy property when landed on
	
	// constructor:
	public PropertyCardPanel()
	{
		setBackground (Color.white);
		setPreferredSize (new Dimension(WIDTH, HEIGHT));			
	} // end PropertyCardPanel constructor
	
	// will actually draw the image:
	public void paintComponent(Graphics g)
	{	
		super.paintComponent(g);
		image.paintIcon(this, g, 5, 35);	
	} // end paintComponent
	
	// Changes the image based on which PropertyMenuPanel item is selected
	// from the menu (JComboBox)
	public void changeImage(String str)
	{
		// Creates a new ImageIcon from the name (String) of the property selected
		// and repaints
		image = new ImageIcon("./property_images/" + str);
		repaint();
	} // end changeImage
	
	public void setCostLabel(int price)
	{
		cost = new JLabel("Property Price:  $" + price);
		Font curFont = cost.getFont();

	    cost.setFont(new Font(curFont.getFontName(), curFont.getStyle(), 20));
		add(cost);
	}
	
} // end class PropertyCardPanel